package com.slj.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.slj.comm.responce.R;
import com.slj.model.Query.SquadQuery;
import com.slj.model.entity.Squad;
import com.slj.model.vo.SquadVo;
import com.slj.service.SquadService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import org.apache.ibatis.annotations.Delete;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 小组表 前端控制器
 * </p>
 *
 * @author 礼俊
 * @since 2025-10-22 10:20
 */
@RestController
@RequestMapping("/squad")
public class SquadController {
    @Autowired
    private SquadService squadService;
    //查询所有小组以及相关小组人员或者根据小组名称进行查询
    @GetMapping("/searchList")
    @Operation(summary = "查询所有小组以及相关小组人员")
    @Parameter(name = "squadQuery", description = "小组查询参数")
    public R<List<SquadVo>> list(@RequestParam String name) {
        List<SquadVo> allSquads = squadService.getSquadsAndUsers(name);
        return R.success(allSquads);
    }
    //查询所有小组
    @GetMapping("/listSquad")
    @Operation(summary = "查询所有小组")
    public R<List<Squad>> list() {
        List<Squad> allSquads = squadService.getAllSquads();
        return R.success(allSquads);
    }




}
